package com.example.bugly

import android.content.Intent
import android.os.Bundle
import android.view.View
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import com.blankj.utilcode.util.SPUtils
import com.blankj.utilcode.util.ToastUtils
import com.tencent.bugly.crashreport.CrashReport
//可以统计app崩溃次数，页面无响应次数，可以上传到bugly的后台，可以检测到
//注意要代码反混淆，否则后台就看到的是混淆后的，
//当然也可以混淆但是要上传混淆规则给bugly后台
class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        enableEdgeToEdge()
        setContentView(R.layout.activity_main)
        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets ->
            val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
            insets
        }
    }

    fun bugly(view: View) {
        SPUtils.getInstance().put("bugly",true)
        ToastUtils.showShort("${SPUtils.getInstance().getBoolean("bugly")}")
        CrashReport.initCrashReport(getApplicationContext(), "41b4ee4aa6", true);
        startActivity(Intent(this, MainActivity2::class.java))
    }
}